<template>
  <el-scrollbar style="">
    <el-timeline class="timeline" style="max-height: 300px">
      <el-timeline-item
        v-for="(activity, index) in activities"
        :key="index"
        :color="colors[index % 5]"
        :timestamp="activity.time"
      >
        <span style="color: blue">{{ activity.committer }}</span
        >:
        <span> {{ activity.content }}</span>
        <div>{{ activity.email }}</div>
        <div
          style="
            width: 250px;
            word-break: break-all;
            font-size: 10px;
            opacity: 70%;
          "
        >
          版本号:{{ activity.name }}
        </div>
      </el-timeline-item>
    </el-timeline>
  </el-scrollbar>
</template>

<script>
import request from "@/utils/request";
export default {
  name: "HistoryRecord",
  data() {
    return {
      colors: ["CornflowerBlue", "Crimson", "Green", "Gray", "Gold"],
      activities: [
        {
          name: "一号",
          content: "Event start",
          time: "2018-04-15",
        },
        {
          name: "2号",
          content: "Approved",
          time: "2018-04-13",
        },
        { name: "san号", content: "Success", time: "2018-04-11" },
      ],
    };
  },
  mounted() {
    this.getActivities();
  },
  methods: {
    getActivities() {
      request
        .get(
          "/house/getHouseRecord?ownnername=" +
            this.$route.params.username +
            "&housename=" +
            this.$route.params.housename
        )
        .then((res) => {
          if (res.code == 200) {
            this.activities = res.data;
            console.log("获取仓库记录成功");
          } else {
            console.log("获取仓库记录异常");
          }
        });
    },
  },
};
</script>
<style scoped>
.timeline {
  margin-top: 100px;
}
</style>
